<#assign contextPath=springMacroRequestContext.getContextPath() />
<#import "/public/frame/main.html" as frame />
<@frame.head "南航明珠商城-商品规格管理"> </@frame.head>

<nav class="breadcrumb">
	<i class="Hui-iconfont">&#xe67f;</i> 后台管理中心 <span class="c-gray en">&gt;</span> 账号管理 <span
		class="c-gray en">&gt;</span> 老师账号 <a class="btn btn-success radius r"
		style="line-height:1.6em;margin-top:3px"
		href="javascript:location.replace(location.href);" title="刷新"><i
		class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
<form method="post" name="query_product_form"  id="query_product_form" action="${contextPath}/stu/sutlist" >    
   <input type="hidden" name="page" value="${pagination.pageNo}"  id="page" />  
   <input type="hidden" name="checkboxs" value="${checkboxs}"  id="checkboxs" />
   <input type="hidden" name="upOrDown" value="${upOrDown}"  id="upOrDown" />                           
    <div class="text-c">
        <table class="table search_table">
           <tr>  
          <!--  <td>用户名：</td>
           <td><input type="text" class="input-text  radius"  placeholder="用户名" id="" name="name" value="${stuQo.name}" ></td>
           <td>手机号：</td>
           <td><input type="text" class="input-text  radius"  placeholder="手机号" id="" name="phone" value="${stuQo.phone}"></td>  
				 -->
				用户名:&nbsp;&nbsp;<input type="text" class="input-text" style="width:250px" placeholder="输入用户名" id="" value="${stuQo.name}" name="name">&nbsp;&nbsp;手机号:&nbsp;&nbsp;<input type="text" class="input-text" style="width:250px" placeholder="输入手机号" value="${stuQo.phone}" id="" name="phone">
		&nbsp;&nbsp;<button type="submit" class="btn btn-success radius" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜用户</button>
				
				
          </tr>
			<!-- <td colspan="6" style="text-align:center;" >
           <input class="btn btn-success radius" type="submit"    value="搜索" />
             </td> -->

      </table>
    </div>
</form>

    <div class="cl pd-5 bg-1 bk-gray mt-20"> 
    <span class="l">
    <a href="javascript:;" onclick="addStudent();" type="button"
			class="btn btn-primary radius" > 添加账号</a> 
    </span>
    <span class="r">共有数据：<strong>${pagination.totalCount}</strong> 条</span> </div>
    <table class="table table-border table-bordered table-bg">
        <thead>
        <tr class="text-c">
            <th>序号</th>
            <th>用户名</th>
            <th>手机号</th>
            <th>所属专业</th>
            <th>身份</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
         <#list pagination.list as list> 
         <tr class="text-c">
            <td>${(pagination.pageNo-1)*10 + list_index+1}</td>
            <td>
            <#if type==1 >
					 ${list.name}
			<#elseif type==2 > ${list.student.name}
			</#if>
           </td>
            <td>       
            <#if type==1 >
					 ${list.phonenumber}
			<#elseif type==2 > ${list.student.phonenumber}
			</#if></td>
            <td>   
            <#if type==1 >
					<#if list.theirprofession==1>	
						美术
					</#if>
					<#if list.theirprofession==2>	
						舞蹈
					</#if>
			<#elseif type==2 > 
					<#if list.student.theirprofession==1>	
						美术
					</#if>	
					<#if list.student.theirprofession==2>	
						舞蹈
					</#if>		
			</#if></td>
            <td>学生</td>
           <#if type==1 >
           	 <td>
				<a href="${contextPath}/stu/stutoview?id=${list.id}" type="button"
					>查看</a>&nbsp;&nbsp;&nbsp;
            <a href="javascript:;" type="button"
					onclick="delrole(${list.id?c});">删除</a>&nbsp;&nbsp;&nbsp;
            </td>
           </#if>
            <#if type==2 >
           	 <td>
				<a href="${contextPath}/stu/stutoview?id=${list.student.id}" type="button"
					>查看</a>&nbsp;&nbsp;&nbsp;
            <a href="javascript:;" type="button"  
					onclick="delrole(${list.student.id?c});">删除</a>&nbsp;&nbsp;&nbsp;
            </td>
           </#if>
         </tr>
         <!-- ${(list.createDate?string("yyyy-MM-dd"))!} -->
         </#list>
        </tbody>
    </table>
    <div id="div_page" style="padding-top: 10px;float: right"></div>
</div>
<@frame.end "default">
</@frame.end>
</html>
<script type="text/javascript"
	src="${contextPath}/resources/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript"
	src="${contextPath}/resources/js/laypage/laypage.js"></script>
<script type="text/javascript">
var path="${contextPath}";
function delrole(id){
	layer.confirm("确定删除此角色吗?",function(){
		layer.closeAll('dialog');
		var layer_load_window = layer.load(2); 
		  $.ajax({
				url : path+"/stu/student_delete",
				cache : false,
				type : 'post',
				dataType : 'html',
				data : {
					"id":id},
				error : function() {
					layer.alert("操作失败!");
				},
				success : function(message) {
	        		if(message == "200"){
	                    layer.msg('操作成功!',{icon:1,time:1000},function(){
	                        window.location.reload();
	                    });
	 				}else if(message == "500"){
	 					layer.alert("系统繁忙！");
	 				}else{
	 					layer.alert(message);
	 				}
				},complete: function(XMLHttpRequest, textStatus) {
					layer.close(layer_load_window);
				}
		  });
	});
}
/*编辑*/
function addStudent(){
	  var url=path+"/stu/stutoadd"
	  if(url!=""){
	      var index = layer.open({
	            type: 2,
	            title: '添加账号',
	            scrollbar: false,
	            content: url,
	            area: ['500px', '290px']
	        });
	    }
}


laypage({
	cont: 'div_page',//容器。值支持id名、原生dom对象，jquery对象。
    pages: ${pagination.totalPage},//通过后台拿到的总页数
    curr:  ${pagination.pageNo} || 1, //当前页
    skip: true, //是否开启跳页
	first: 1, //将首页显示为数字1,。若不显示，设置false即可
    last: ${pagination.totalPage},
    jump: function(obj , first){//触发分页后的回调
        if(!first){ //点击跳页触发函数;当前页为obj.curr
        	window.location.href = path + "/stu/sutlist?page=" + obj.curr
        }
    }
})  

</script>